package com.sx.pipeline.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.noober.background.view.BLImageView
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.DeviceInfoVo

/**
 * @Author：YY
 * @Date：2022/2/10
 * @Describe: 台账设备适配器
 */
class LedgerDeviceAdapter(
) : BaseQuickAdapter<DeviceInfoVo, BaseViewHolder>(
    R.layout.item_ledger
) {
    override fun convert(holder: BaseViewHolder, item: DeviceInfoVo) {
        //设备图片
        if (item.productImage != null) {
            val imageList = item.productImage.split(",")
            val image = holder.getView<BLImageView>(R.id.iv_img)
            Glide.with(context).load(imageList[0]).into(image)
        }
        //设备名称
        holder.setText(R.id.tv_device_name,item.name)
        //设备型号
        holder.setText(R.id.tv_device_model,"产品型号："+item.productModel)
        //出厂日期
        holder.setText(R.id.tv_factory_time,"出厂日期："+item.productionDate)
    }

}